/*
day385 
2020.9.16 
*/ 
#include<iostream>
#include<cstdlib>
#include<vector>
using namespace std;

class Solution {
public:
    int thirdMax(vector<int>& nums) {
		int first=INT_MIN,second=INT_MIN,third=INT_MIN;
		for(int i=0;i<nums.size();++i)
		{
			if(nums[i]>first)
			{
				third=second;
				second=first;
				first=nums[i];
			}
			else if(nums[i]<first && nums[i]>second)
			{
				third=second;
				second=nums[i];
			}
			else if(nums[i]<second && nums[i]>third)
			{
				third=nums[i];
			}
		}
		if(first!=second && second!=third)
		{
			return third;
		 } 
		return first; 
    }
};

int main()
{
	return 0;
 } 
